function kaishi(){
	var step=$("#step").val();
    var logo=$("#logo").val();
    var size=$("#size").val();
     
    var logooptions = document.getElementById("logoselect").options;

    for (i=0; i<logooptions.length; i++){
    if (logooptions[i].value == logo) // 根据option标签的ID来进行判断 测试的代码这里是两个等号
	    {
    	logooptions[i].selected = true;
    	document.getElementById("resultlogo").innerHTML=logooptions[i].innerHTML;
	    }
    else
    	{
    	logooptions[i].selected = false;
    	}
    }
    $.post("../front/getSizeByLogo",{logo:logo,step:step},
    	      function(data){
    	        var list = eval(data);
    	        for(var i=0; i<list.length; i++)  
    	        {
    	            document.getElementById("sizeselect").options.add(new Option(list[i].french_size, list[i].french_size));
    	        }
    	        
    	        var sizeoptions = document.getElementById("sizeselect").options;
    	        for (i=0; i<sizeoptions.length; i++){
    	            if (sizeoptions[i].value == size) // 根据option标签的ID来进行判断 测试的代码这里是两个等号
    	        	    {
    	            	sizeoptions[i].selected = true;
    	            	document.getElementById("resultsize").innerHTML=sizeoptions[i].value;
    	        	    }
    	            else
    	            	{
    	            	sizeoptions[i].selected = false;
    	            	}
    	            }
    	        
    	      });
    
}

function back(){
    var step=$("#step").val();
    var logo=$("#logo").val();
    var size=$("#size").val();
    $.post("../front/checkLogo",{logo:logo,step:step},
    	      function(data){
    	       if(data=="1")
    	    	   {
    	    	   window.location.replace("../front/index?logo="+logo+"&size="+size+"&step="+step);
    	    	   }
    	       else
    	    	   {
    	    	   alert("您已选择过该品牌，请选择其他品牌");
    	    	   }
    	      });
    //window.location.href="../front/index?logo="+logo+"&size="+size+"&step="+step;
}

function chooselogo(btn){
    var step=document.getElementById("step").value;
    var logooptions = document.getElementById("logoselect").options;
    var sizeoptions = document.getElementById("logoselect").options;
    for (i=0; i<logooptions.length; i++){
    if (logooptions[i].value == btn.id) // 根据option标签的ID来进行判断 测试的代码这里是两个等号
	    {
    	logooptions[i].selected = true;
	    }
    else
    	{
    	logooptions[i].selected = false;
    	}
    }
    //$("#logoselect").find('option[value="+btn.id+"]').attr("selected",true);
    //$('#logoselect option[value="'+btn.id+'"]').attr("selected",true);
    document.getElementById("sizeselect").innerHTML="";
    $("#logo").val(btn.id);
    
    document.getElementById("resultlogo").innerHTML=btn.innerHTML;
    


    $.post("../front/getSizeByLogo",{logo:btn.id,step:step},
      function(data){
        var list = eval(data);
        for(var i=0; i<list.length; i++)  
        {  
            document.getElementById("sizeselect").options.add(new Option(list[i].french_size, list[i].french_size));
        } 
        var sizeoptions = document.getElementById("sizeselect").options;
        document.getElementById("resultsize").innerHTML=sizeoptions[0].value;
        $("#size").val(sizeoptions[0].value);
      });
    
    
    
}
function changelogo(opt){
    var step=document.getElementById("step").value;
    document.getElementById("sizeselect").innerHTML="";
    $("#logo").val(opt.value);
    document.getElementById("resultlogo").innerHTML=opt.text;
    document.getElementById("resultsize").innerHTML="?";
    $.post("../front/getSizeByLogo",{logo:opt.value,step:step},
      function(data){
        var list = eval(data);
        for(var i=0; i<list.length; i++)  
        {  
            document.getElementById("sizeselect").options.add(new Option(list[i].french_size, list[i].french_size));
        }  
        var sizeoptions = document.getElementById("sizeselect").options;
        document.getElementById("resultsize").innerHTML=sizeoptions[0].value;
        $("#size").val(sizeoptions[0].value);
    });
}

function changesize(opt){
    $("#size").val(opt.value);
    document.getElementById("resultsize").innerHTML=$("#size").val();
}

